import request from '@/router/axios';

// 获取列表
export const getList = (inquiryType,current,size,params) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      inquiryType
    }
  })
}
// 修改
export const update = (data) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/update',
    method: 'post',
    data
  })
}
// 修改记录
export const record = (id) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/record',
    method: 'get',
    params: {
      id
    }
  })
}
// 审批查看修改记录
export const record1 = (id) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/approve',
    method: 'get',
    params: {
      id
    }
  })
}

// 提交审批
export const approval = (id) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/start-process',
    method: 'get',
    params: {
      id
    }
  })
}

export const detail = (id) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 根据供应商名称或编号模糊获取供应商列表
export const getSupplierList = (name) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/getSupplierByNoOrName',
    method: 'get',
    params: {
      name
    }
  })
}

// 根据供应商获取所有物料信息
export const getMaterialGroupNoBySupplierId = (supplierId,materialType) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/getMaterialGroupNoBySupplierId',
    method: 'get',
    params: {
      supplierId,
      materialType
    }
  })
}

export const save = (data) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/saveBatch',
    method: 'post',
    data
  })
}

// 确认
export const confirmPrice = (ids) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/submit',
    method: 'post',
    params: {
      ids
    }
  })
}

// 删除
export const remove = (ids) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/remove',
    method: 'post',
    params: {
      ids
    }
  })
}

// 修改手动添加
export const updateMaterialPriceLibrary = (data) => {
  return request({
    url: '/api/blade-purchase/materialpricelibrary/updateMaterialPriceLibrary',
    method: 'post',
    data
  })
}
